IdeaBlade DevForce 2010 Help Reference
DelegateVerifier<T> Constructor(String,VerifierCondition<T>)
See Also  Example Send Feedback
IdeaBlade.Validation Assembly > IdeaBlade.Validation Namespace > DelegateVerifier<T> Class > DelegateVerifier<T> Constructor : DelegateVerifier<T> Constructor(String,VerifierCondition<T>)



errorMessage
Error message for failed verification
verifierCondition
Defines the verification to be performed
Initializes a new instance of the DelegateVerifier class.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal errorMessage As String, _
   ByVal verifierCondition As IdeaBlade.Validation.VerifierCondition(Of T) _
)
Visual Basic (Usage)Copy Code
Dim errorMessage As String
Dim verifierCondition As IdeaBlade.Validation.VerifierCondition(Of T)
 
Dim instance As New DelegateVerifier(Of T)(errorMessage, verifierCondition)
C# 
public DelegateVerifier<T>( 
   string errorMessage,
   IdeaBlade.Validation.VerifierCondition<T> verifierCondition
)
C++/CLI 
public:
DelegateVerifier<T>( 
   String^ errorMessage,
   IdeaBlade.Validation.VerifierCondition<T^>^ verifierCondition
)

Parameters

errorMessage
Error message for failed verification
verifierCondition
Defines the verification to be performed

Example

C#Copy Code
private DelegateVerifier SampleDelegateVerifier() {
   // A simple example adding a delegate verifier for the Employee HireDate property.
   // This verifier could more easily be handled using a DateTimeRangeVerifier,
   // but is intended to show the parts to a DelegateVerifier.

   string errorMessage = "HireDate must be greater than MinValue";

   // Define the verification test. 
   VerifierCondition<Employee> condition = (emp, trigger, ctx) => {
     // Note when executed before the property is set that we must inspect the ProposedValue.
     DateTime? hireDate = (trigger.Timing == TriggerTiming.BeforeSet) ? (DateTime?) trigger.ProposedValue : emp.HireDate;
     return new VerifierResult(hireDate >= DateTime.Parse("1/1/2000"));
   };

   // Create the verifier.
   var v = new DelegateVerifier<Employee>(errorMessage, condition);

   // Add a trigger - here it's the HireDate property.
   v.AddTrigger(Employee.PropertyMetadata.HireDate.Name);

   return v;
 }

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.